package guoanmaker.operator.business.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import guoanmaker.operator.business.model.OperatorActivityApplication;
/**
 * @author wanghongwei 
 * @ClassName: OperatorActivityApplicationRepository 
 * @Description: OperatorActivityApplicationRepository
 * @date 2017/8/10
 */
public interface OperatorActivityApplicationRepository extends JpaRepository<OperatorActivityApplication, String>, JpaSpecificationExecutor<OperatorActivityApplication>{
	@Query("select aa from OperatorActivityApplication aa where aa.activityId=:activityId  ORDER BY aa.weight ASC")
	public List<OperatorActivityApplication> queryActivityApplicationList(@Param("activityId") String activityId);
	@Transactional
	@Modifying
	@Query("delete from OperatorActivityApplication aa where aa.activityId=:activityId")
	public void deleteAllActivityApplicationById(@Param("activityId") String activityId);
	
}
